import { mergeConfig } from 'vite'
import eslint from 'vite-plugin-eslint'
import baseConfig from './vite.config.base'
import configStyleImportPlugin from './plugin/styleImport'
import configArcoResolverPlugin from './plugin/arcoResolver'

export default mergeConfig(
  {
    mode: 'development',
    server: {
      port: 8025,
      open: false,
      fs: {
        strict: true
      },
      hmr: true,
      proxy: {
        '/knife': {
          // target: 'https://yuxi.fun/knife',
          target: 'http://192.168.98.122:81/dz',
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/knife/, '')
        }
      }
    },
    plugins: [
      eslint({
        cache: false,
        include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
        exclude: ['node_modules']
      }),
      configArcoResolverPlugin(),
      configStyleImportPlugin()
    ]
  },
  baseConfig
)
